<template>
  <div class="exhibits-content" :style="{ width: props.info.width + 'rem', height: props.info.height + 'rem' }">
    <img
      :src="publicUrls + 'free/style11/displayBoardStyle1Bg-Line.webp'"
      alt=""
      class="border"
    />
    <div
      class="item-parent"
      v-for="(item, index) in props.info.showpieceList"
      :key="index"
      :class="props.info.showpieceList?.length !== 1 && index !== props.info.showpieceList?.length - 1 && 'item-after'"
    >
      <div
        class="exhibits-item"
        @contextmenu.stop="emit('onContextMenuChild', $event, index)"
        :style="{
          background: `url(${
            publicUrls + 'free/style11/displayBoardStyle1Bg.webp'
          }) no-repeat center/100% 100%`,
        }"
      >
        <div class="cover-box border-hover-style" @click="viewImg(item.moduleId, item.id)">
          <!-- <div class="overlay">{{ item.description }}</div> -->
          <img
            v-if="route.meta.loopType"
            class="flower-btn"
            v-lazy="publicUrls + 'free/style11/flower.webp'"
          />
          <img class="cover" v-lazy="getLinkUrl(item.coverUrl + '?imageView2/w/600/h/600/format/webp')" alt="" />
          <img class="style11CoverImg" :src="publicUrls + 'free/style11/style11CoverImg.png'" alt="" />
        </div>
        <div class="items-title">
          <p>{{ item.name }}</p>
        </div>
      </div>
    </div>
    <img
      :src="publicUrls + 'free/style11/displayBoardStyle1Bg-Line.webp'"
      alt=""
      class="border"
    />
    <div class="shadown">
      <!-- <img
        :src="publicUrls + 'free/style11/displayBoardStyle1-shadownL.webp'"
        alt=""
        class="shadownL"
      />
      <img
        :src="publicUrls + 'free/style11/displayBoardStyle1-shadown.webp'"
        alt=""
        class="shadownC"
      />
      <img
        :src="publicUrls + 'free/style11/displayBoardStyle1-shadownR.webp'"
        alt=""
        class="shadownL"
      /> -->
      <div class="shadownL"></div>
      <div class="shadownC"></div>
      <div class="shadownL"></div>
    </div>
  </div>
</template>

<script lang="ts">
export default defineComponent({
  name: 'free11Style1',
});
</script>

<script setup lang="ts">
import { urls, getLinkUrl } from '@/utils/request/upload';
import { publicUrls } from '@/utils/minxin';
import { DraggableContainer } from 'vue3-draggable-resizable';
// import FlotMenu from '@/components/flotMenu/OutlineMenu.vue';
import ContextMenu from '@imengyu/vue3-context-menu';
import { getDraggableNumber, getExhibitsHeightRest, getdisabledY } from '@/utils/getRemComputed';
import { ref, reactive, watch, nextTick } from 'vue';
import { exbitMenuShow, exbitListMenuShow } from '@/hooks/menuHooks';
import { useProjectStore } from '@/store';
import { defineComponent } from 'vue';
import { useRoute } from 'vue-router';

const emit = defineEmits([
  'emitChildItemDraggable',
  'emitChildItemDraggableStyle',
  'emitShowcaseDraggable',
  'emitShowcaseDraggableStyle',
  'onContextMenuChild',
]);
const store = useProjectStore();
const route = useRoute();
const contextMenuTrigger = ref(); //列表盒子dom
const parentLock = ref(true);
const childShow = ref(true);
const draggableResizable = ref(); //父级拖拽盒子ref
const timer = ref();
const ImgVisible = ref(false);
const ImgUrl = ref('');

const props = defineProps({
  width: {
    type: Number || String,
  },
  height: {
    type: Number || String,
  },
  indexs: {
    type: Number,
  },
  info: {
    type: Object,
  },
  childId: {
    type: Number,
  },
  AuxiliaryId: {
    type: Number,
  },
});
const emitChildItemDraggable = (draggingInfo: any, childIndex: number) => {
  emit('emitChildItemDraggable', draggingInfo, childIndex); //分组传递当前展品图距离相对父元素的xy偏移量变化
};
const emitChildItemDraggableStyle = (draggingInfo: any, childIndex: number) => {
  emit('emitChildItemDraggableStyle', draggingInfo, childIndex); //分组设置当前展品图距离相对父元素的宽高变化
};
const emitShowcaseDraggable = (draggingInfo: any) => {
  emit('emitShowcaseDraggable', draggingInfo); //传递当前展柜图距离相对父元素的xy偏移量变化
};
const emitShowcaseDraggableStyle = (draggingInfo: any) => {
  emit('emitShowcaseDraggableStyle', draggingInfo); //传递当前展柜距离相对父元素的宽高变化
};

const handleMouseDown = (event) => {
  event.stopPropagation();
};
const preventDefaultDrag = (event) => {
  event.stopPropagation();
};
console.log(props.info.showpieceList);

const viewImg = (moduleId: number, e?: number) => {
  store.exhibitsModuleId = moduleId;
  store.exhibitsShowpieceid = e;
  store.exhibitsInfoShow = true;
};

// watch(
//   () => props.info.width,
//   () => {
//     childShow.value = false;
//     nextTick(() => {
//       childShow.value = true;
//     });
//   },
//   { deep: true },
// );
// watch(
//   () => props.info.height,
//   () => {
//     childShow.value = false;
//     nextTick(() => {
//       childShow.value = true;
//     });
//   },
//   { deep: true },
// );

//
</script>

<style lang="less" scoped>
.exhibits-content {
  position: relative;
  display: flex;
  justify-content: center;
  z-index: 999;
  padding: 0px !important;
  -webkit-box-reflect: below 20% linear-gradient(transparent, rgba(0, 0, 0, 0.3));
}
.border {
  width: 16px;
  height: 416px;
  margin-top: 20px;
  object-fit: cover;
}
.active {
  :deep(.flot-menu) {
    display: flex;
  }
}
:deep(.active) {
  z-index: 999;
}
:deep(.vdr-handle) {
  z-index: 66;
}
.item-parent {
  width: 580px;
  height: 416px;
  position: relative;
  margin-top: 20px;
}
.item-after {
  &::after {
    content: '';
    position: absolute;
    top: 50%;
    right: -1px;
    transform: translate(0, -50%);
    width: 2px;
    height: 384px;
    z-index: 1;
    background: linear-gradient(
      180deg,
      rgba(223, 203, 171, 0) 0%,
      #ddc9a9 6.58%,
      #cbb58f 93.38%,
      rgba(202, 179, 141, 0) 100%
    );
    filter: blur(1px);
  }
}
.exhibits-item {
  width: 100%;
  height: 100%;
  display: flex;
  flex-direction: column;
  align-items: center;
  padding-top: 60px;
}
.cover-box {
  display: flex;
  align-items: center;
  justify-content: center;
  width: 474px;
  height: 263px;
  position: relative;
  overflow: hidden;
  &:hover .cover {
    // transform: scale(1.2);
    opacity: 1;
  }
  .cover {
    width: 100%;
    height: 100%;
    object-fit: contain;
    transition: all 0.3s ease;
  }
  .style11CoverImg {
    width: 132px;
    height: 40px;
    object-fit: contain;
    position: absolute;
    bottom: -5px;
    right: -8px;
  }
}
.flower-btn {
  width: 50px;
  height: 50px;
  object-fit: cover;
  position: absolute;
  top: 50%;
  left: 50%;
  transform: translate(-50%, -50%);
  animation: flower 2s linear infinite;
  @keyframes flower {
    0% {
      opacity: 0;
    }
    40% {
      opacity: 100%;
    }
    60% {
      opacity: 100%;
    }
    100% {
      opacity: 0;
    }
  }
}
.items-title {
  width: 440px;
  height: 64px;
  margin-top: 8px;
  display: flex;
  justify-content: center;
  align-items: center;
  ::v-deep p {
    font-family: SourceHanSerifCN-Bold;
    font-size: 18px;
    color: #ffecc3;
    text-shadow: 0px 1px 1px rgba(133, 121, 104, 0.6);
    line-height: 32px;
    text-align: center;
    overflow: hidden;
    display: -webkit-box;
    -webkit-line-clamp: 2;
    -webkit-box-orient: vertical;
  }
}
.shadown {
  position: absolute;
  bottom: 30px;
  left: 50%;
  transform: translateX(-50%);
  width: calc(100% - 70px);
  height: 50px;
  display: flex;
  align-items: center;
  justify-content: center;
  overflow: hidden;
  .shadownL {
    width: 70px;
    height: 100%;
    flex-shrink: 0;
    background: url('https://static.jiyi.show/free/style11/displayBoardStyle1-shadownL.webp')
      no-repeat center/100% 100%;
    &:last-child {
      background: url('https://static.jiyi.show/free/style11/displayBoardStyle1-shadownR.webp')
        no-repeat center/100% 100%;
    }
  }
  .shadownC {
    flex: 1;
    height: 100%;
    background: url('https://static.jiyi.show/free/style11/displayBoardStyle1-shadown.webp')
      no-repeat center/100% 100%;
  }
}
</style>
